from selenium.webdriver.common.by import By

from pages.BasePage import BasePage


class LoginPage(BasePage):
	"""
	在这里写定位器，通过元素属性定位元素对象
	"""
	url = "http://8.137.19.140:9090/blog_login.html"
	username_loc = (By.CSS_SELECTOR, '#username')  # 定位用户名输入框
	password_loc = (By.CSS_SELECTOR, '#password')  # 定位密码输入框
	click_btn = (By.CSS_SELECTOR, '#submit')  # 定位提交按钮

	def open_page(self):
		self.get(self.url)

	def input_username_text(self, text):
		self.send_key(self.username_loc, text)

	def input_password_text(self, text):
		self.send_key(self.password_loc, text)

	def click_login_btn(self):
		self.click(self.click_btn)